<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

class CreateRoutingController extends Controller
{
    /**
     * @Route("/createRouting/show/{page}", name="create_routing_show", requirements={"page": "\d+"})
     */
    public function showAction(Request $request,$page = 1)
    {

        //生成一个url
        $url = $this->generateUrl(
            'create_routing_show',
            array('page' => '10')
        );
        echo $url;
        echo '<br />';


        //生成一个完成http的url
        $url = $this->generateUrl('create_routing_show', array('page' => '100'), UrlGeneratorInterface::ABSOLUTE_URL);
        echo $url ;
        echo '<br />';

        return $this->render('test/CreateRoutingController-show.html.twig', [
            'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
        ]);

    }


}
